/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package si.projekt.DB;

import javax.persistence.EntityManager;
import javax.persistence.Persistence;

/**
 *
 * @author Igor
 */
public class DB {
    
    EntityManager em;

    public DB() {
        em = Persistence.createEntityManagerFactory("PopustekPU").createEntityManager();
    }
    
    //String priimek, String naslov, String hisnaStevilka, String posta, int postnaStevilka, String email, String tel
    public boolean dodajUporabnika(String ime, String priimek, String ulica, int postnaSt, String posta, String email, int telefonska) {
        em.getTransaction().begin();
        Uporabnik up = new Uporabnik();
        up.setIme(ime);
        up.setPriimek(priimek);
        up.setUlica(ulica);
        up.setPostnaSt(postnaSt);
        up.setPosta(posta);
        up.setEmail(email);
        up.setTelefonska(telefonska);
        em.persist(up);
        em.getTransaction().commit();
        em.close();

        return true;
    }
    
    
    
    
}
